package t20220303;

/**
 * @Author: DengJia
 * @Date: 2022/3/4 20:57
 * @Description:
 */

public class Concatenation {
    public static void main(String[] args) {
        String s = "中";
        String concat = "hello" + s + "国" + "万岁";
        System.out.println(concat);

        String[] ss = {"1", "2", "3"};
        doThis(ss, 0);
        doThis(ss, 1);
    }

    private static void doThis(String[] fields, int flag) {
        if (0 == flag) {
            String s = "";
            for (String field : fields) {
                s += field;
            }
            System.out.println(s);
        } else {
            StringBuilder builder = new StringBuilder();
            for (String field : fields) {
                builder.append(field);
            }
            System.out.println(builder);
        }
    }
}
